package com.hnkywl.sts.entity.jhgl;

import com.hnkywl.sts.entity.BaseEntity;
import com.hnkywl.sts.entity.organ.*;
import com.hnkywl.sts.entity.sys.Yg;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: ZHUCHG
 * Date: 13-6-24
 * Time: 下午9:04
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table(name = "T_BIZ_BGJHHZ")
@Where(clause = "deleted!='1'")
public class Bgjhhz extends BaseEntity {
    //ID
    @Id
    @SequenceGenerator(name = "seqBgjhhz", allocationSize = 1, sequenceName = "SEQ_BIZ_BGJHHZ")
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "seqBgjhhz")
    private Long id;
    //计划类型
    // 计划类别  ydjh:月度计划  jyljh急用料计划  zjjh:追加计划  bccbjh:补充储备计划
    private String type;

    //计划编码
    private String bm;
    // 路径
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "LJ_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Lj lj;
    // 经营机构
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "JYJG_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Nbgs jyjg;
    // 供应站
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "GYZ_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Nbbm gyz;
    //到货仓库
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "DHCK_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Ck dhck;
    // 保供计划单位
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "JHDW_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Gsjg jhdw;
    // 保供计划单位
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "JHQD_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Gsjg jhqd;
    //计划说明
    private String sm;
    //计划年月
    private Date jhsj;
    //计划年份
    private Integer jhnf;
    //计划月份
    private Integer jhyf;
    //状态
    //1=新建,2=已提交，3=供应站已处理，4=业务科已处理,5=正在提交,6=已经提交到物供,7=计划科已处理,8=采购单已办理
    private Integer zt = 1;
    //接口计划ID
    private int jkjhid;
    //保供计划
    @OneToMany(fetch = FetchType.LAZY, targetEntity = Bgjh.class, mappedBy = "bgjhhz")
    @NotFound(action = NotFoundAction.IGNORE)
    private List<Bgjh> bgjhList;
    //保供计划汇总明细
    @OneToMany(fetch = FetchType.LAZY, cascade = CascadeType.ALL,
            targetEntity = Bgjhhzmx.class, mappedBy = "bgjhhz")
    @NotFound(action = NotFoundAction.IGNORE)
    private List<Bgjhhzmx> bgjhhzmxList;

    // 汇总人
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "BGJHHZR_ID")
    @NotFound(action = NotFoundAction.IGNORE)
    private Yg bgjhhzr;
    // 汇总日期
    private Date bgjhhzrq;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getBm() {
        return bm;
    }

    public void setBm(String bm) {
        this.bm = bm;
    }

    public Lj getLj() {
        return lj;
    }

    public void setLj(Lj lj) {
        this.lj = lj;
    }

    public Nbgs getJyjg() {
        return jyjg;
    }

    public void setJyjg(Nbgs jyjg) {
        this.jyjg = jyjg;
    }

    public Nbbm getGyz() {
        return gyz;
    }

    public void setGyz(Nbbm gyz) {
        this.gyz = gyz;
    }

    public Ck getDhck() {
        return dhck;
    }

    public void setDhck(Ck dhck) {
        this.dhck = dhck;
    }

    public Gsjg getJhdw() {
        return jhdw;
    }

    public void setJhdw(Gsjg jhdw) {
        this.jhdw = jhdw;
    }

    public Gsjg getJhqd() {
        return jhqd;
    }

    public void setJhqd(Gsjg jhqd) {
        this.jhqd = jhqd;
    }

    public String getSm() {
        return sm;
    }

    public void setSm(String sm) {
        this.sm = sm;
    }

    public Date getJhsj() {
        return jhsj;
    }

    public void setJhsj(Date jhsj) {
        this.jhsj = jhsj;
    }

    public Integer getJhnf() {
        return jhnf;
    }

    public void setJhnf(Integer jhnf) {
        this.jhnf = jhnf;
    }

    public Integer getJhyf() {
        return jhyf;
    }

    public void setJhyf(Integer jhyf) {
        this.jhyf = jhyf;
    }

    public Integer getZt() {
        return zt;
    }

    public void setZt(Integer zt) {
        this.zt = zt;
    }

    public int getJkjhid() {
        return jkjhid;
    }

    public void setJkjhid(int jkjhid) {
        this.jkjhid = jkjhid;
    }

    public List<Bgjh> getBgjhList() {
        return bgjhList;
    }

    public void setBgjhList(List<Bgjh> bgjhList) {
        this.bgjhList = bgjhList;
    }

    public List<Bgjhhzmx> getBgjhhzmxList() {
        return bgjhhzmxList;
    }

    public void setBgjhhzmxList(List<Bgjhhzmx> bgjhhzmxList) {
        this.bgjhhzmxList = bgjhhzmxList;
    }

    public Yg getBgjhhzr() {
        return bgjhhzr;
    }

    public void setBgjhhzr(Yg bgjhhzr) {
        this.bgjhhzr = bgjhhzr;
    }

    public Date getBgjhhzrq() {
        return bgjhhzrq;
    }

    public void setBgjhhzrq(Date bgjhhzrq) {
        this.bgjhhzrq = bgjhhzrq;
    }
}
